<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_freg :: head(~{::title})">
    <meta charset="UTF-8">
    <!--移动端更好的适应-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新增分类</title>
    <link rel="stylesheet" href="../../static/dist/semantic/semantic.min.css"
          th:href="@{/dist/semantic/semantic.min.css}">
    <link rel="stylesheet" href="../../static/css/my.css" th:href="@{/css/my.css}">
    <link rel="stylesheet" href="../../static/lib/editormd/css/editormd.css" th:href="@{/lib/editormd/css/editormd.css}">
</head>
<body>
<!--    导航-->
<nav th:replace="_freg :: menu(3)" class="ui segment inverted attached m-padded-mini m-shadow-small">
    <div class="ui container">
        <div class="ui inverted secondary stackable menu">
            <h2 class="ui teal header item">后台管理</h2>
            <a href="#" class="m-item item m-mobile-hide active"><i class="home icon"></i>博客</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="idea icon"></i>分类</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="tags icon"></i>标签</a>
            <div class="right menu m-item m-mobile-hide">
                <div class="ui dropdown item">
                    <div class="text">
                        <img class="ui avatar image" alt="me.jpg" src="../../static/images/me.jpg">
                        Dylan
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" class="item">修改密码</a>
                        <a href="#" class="item">个人信息</a>
                        <a href="#" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <a href="#" class="ui m-menu m-toggle black icon button m-right-top m-mobile-show">
        <i class="sidebar icon"></i>
    </a>
</nav>
<!--    二级导航-->
<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a href="#" th:href="@{/admin/tags/toSave.do}" class="teal item active">新增</a>
            <a href="#" th:href="@{/admin/tags}" class="item">列表</a>
        </div>
    </div>
</div>

<!--    中间内容-->
<div>
    <div class="m-container-small m-padded-big">
        <div class="ui container">
<!--            验证错误提示-->
            <div class="ui error message" th:unless="${#strings.isEmpty(message)}">
                <i class="close icon"></i>
                <div class="" th:text="|提示: ${message}">提示：操作成功！</div>
            </div>

            <form action="#" method="post" class="ui form" th:action="${tag == null} or ${tag.id == null} ? @{/admin/tags/save} : @{/admin/tags/update}">
                <input type="hidden" name="id" th:value="${tag != null} ? ${tag.id}">
<!--            分类名称-->
                <div class="field">
                    <div class="ui left labeled input">
                        <label class="ui teal basic label">标签名称</label>
                        <input type="text" name="name" placeholder="标签名称" th:value="${tag != null} ? ${tag.name}">
                    </div>
                </div>

<!--            按钮-->
                <div class="ui right aligned container">
                    <button type="button" class="ui blue button" onclick="window.history.go(-1)">返回</button>
                    <button class="ui teal button">发布</button>
                </div>
            </form>
        </div>
    </div>
</div>

<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>

<!--    页脚-->
<footer th:replace="_freg :: footer" class="ui inverted segment  vertical m-padded-large">
    <div class="ui container center aligned">
        <div class="ui inverted stackable grid divided">
            <div class="three wide column">
                <div class="ui inverted link list">
                    <div class="item">
                        <img src="../../static/images/wechat.jpg" class="ui rounded image" alt="亚里士多得"
                             style="width: 100px">
                    </div>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted">最新博客</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item">博客1</a>
                    <a href="#" class="item">博客1</a>
                    <a href="#" class="item">博客1</a>
                    <a href="#" class="item">博客1</a>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted">联系我</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item">QQ:3402747477</a>
                    <a href="#" class="item">邮箱:3402747477@qq.com</a>
                </div>
            </div>
            <div class="seven wide column">
                <h4 class="ui inverted">介绍</h4>
                <div class="ui inverted link list">
                    <p class="m-opacity-mini">
                        这是我的个人博客、会分享关于编程、写作、思考相关的任何内容，希望可以给来到这儿的人有所帮助
                    </p>
                </div>
            </div>
        </div>
        <!--    分隔符-->
        <div class="ui inverted section divider"></div>
        <div class="m-text-thin m-text-spaced m-opacity-mini">
            Copyright 2023-now ZBlog Designed by dylan
        </div>
    </div>

</footer>

<script src="../../static/dist/jquery/jquery-3.4.1.min.js" th:src="@{/dist/jquery/jquery-3.4.1.min.js}"></script>
<script rel="script" src="../../static/dist/semantic/semantic.js" th:src="@{/dist/semantic/semantic.js}"></script>

<script>

    $('.m-menu.m-toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });
    $(".dropdown").dropdown({
        on: "hover"
    });
    /*-- 表单验证 --*/
    $('.ui.form').form({
        fields : {
            title : {
                identifier: 'name',
                rules: [{
                    type : 'empty',
                    prompt : '请输入标签名称'
                }]
            }
        }
    });
    //消息提示关闭初始化
    $('.message .close')
        .on('click', function () {
            $(this)
                .closest('.message')
                .transition('fade');
        });
</script>
</body>
</html>